<!DOCTYPE html>
<html>

	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>建议反馈</title>
		<link rel="stylesheet" href="../../css/mui.min.css">
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/vue.min.js"></script>
		<style>
			* {
				padding: 0;
				margin: 0;
			}

			body {
				background: #fff;
			}

			ul li {
				list-style: none;
			}

			.container_box {
				padding-top: 40px;
			}

			#header {
				display: flex;
				justify-content: space-between;
				align-items: center;
				background: #fff;
				border: none;
				box-shadow: none;
			}

			.mui-icon-left-nav {
				color: #60C68B;
			}

			#header span {
				color: #60C68B;
				font-size: 14px;
			}

			.container_box {
				padding: 50px 10px;
			}

			.txt_box {
				position: relative;
			}

			.txt_box textarea {
				width: 100%;
				padding: 20px;
				height: 240px;
				font-size: 14px;
				background: #EFEFF2;
			}
			.txt_box textarea ::-webkit-input-placeholder {
				color: #999;
				font-size: 10px;
			}
			.txt_box p{
				position: absolute;
				bottom:20px;
				right:20px;
			}
			[v-cloak] {
					display: none;
				}
		</style>
	</head>

	<body>
		<div id="app">
			<header id="header" class="mui-bar mui-bar-nav">
				<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
				<span @click="submit">提交</span>
			</header>
			<div class="container_box">
				<div class="txt_box">
					<textarea v-model="text_area" maxlength="200" placeholder="输入建议以及反馈内容（200字以内）"></textarea>
					<p  v-cloak>{{txt_num}}/200</p>
				</div>
			</div>
		</div>
		<script src="../../js/base.js"></script>
		<script src="../../js/vue-resource.js"></script>
		<script>
			mui.plusReady(function() {
				var vm = new Vue({
					el: "#app",
					data: {
						USEID:"",//useid 用户的id
						text_area: '',
						txt_num: '0'
					},
					methods: {
						submit(){
							if(this.USEID){
								var _this=this;
								plus.nativeUI.showWaiting();
								HTTP.post(this, 'sysAdviceController/saveSysAdviceByApp', function (res) {
									mui.toast("发送成功");
									setTimeout(function(){
										 window.location.reload();
									},1000);
									
								}, function (res) {
									mui.toast(res);
								}, {
									userId: _this.USEID,//用户Id
									adviceContent:_this.text_area//评论内容
								})
							}
							else{
								mui.toast("您还没有登录");
							}
							
						}
						
					},
					created() {
						//把用户的id 之前存放在里storage 里面了!
						this.USEID = plus.storage.getItem('_id');
					},
					watch: {
						text_area: function(val) {
							this.txt_num = val.length
						},
					}
				})
			})
		</script>
	</body>

</html>
